set the member of sprite the spriteNum of me to the normalMember of me
set the setting of me to 0
else
set the member of sprite the spriteNum of me to the toggleMember of me
set the setting of me to 1
end if
updateStage()
end
on beginSprite me
set s to the spriteNum of me
set the NormalMemberNum of me to the memberNum of sprite s
set the ImageCastLib of me to the number of castLib the castLibNum of sprite s
set the normalMember of me to member the NormalMemberNum of me of castLib the ImageCastLib of me
set the toggleMember of me to member the toggleMemberNum of me of castLib the ImageCastLib of me
setValue(me, the setting of me)
end
on getPropertyDescriptionList
if the currentSpriteNum = 0 then
set memdefault to 0
else
set memref to the member of sprite the currentSpriteNum
set castLibNum to the castLibNum of memref
set memdefault to member (the memberNum of member memref + 1) of castLib castLibNum
end if
set p_list to [#toggleMemberNum: [#comment: "Toggle Image:", #format: #graphic, #default: memdefault], #setting: [#comment: "Initially Toggled:", #format: #boolean, #default: 0]]
return p_list
end
on getBehaviorDescription
return "Makes a sprite work as a toggle button. The behavior responds when clicked, or when the SetValue or Toggle messages are receieved." & RETURN & "PARAMETERS:" & RETURN & "• Toggle Image - Choose the cast member to display when the button is toggled." & RETURN & "• Initially Toggled - Turn this option to make the button toggled when it first appears." & RETURN & "MESSAGES:" & RETURN & "• SetValue {TRUE or FALSE} - Sets the toggle button." & RETURN & "• Toggle - Switches the toggle button state."